﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.ServiceModel.Channels.Common;
using System.ServiceModel.Description;
using Microsoft.ServiceModel.Channels;
using System.Xml.Schema;
using System.Xml;

namespace BizTalkFactory.Adapters.AzureStorage
{
    internal sealed class AzureStorageAdapterWsdlRetrieval:IWsdlRetrieval
    {
        private IWsdlRetrieval mBaseWsdlRetrieval;
        private XmlSchemaSet schemaSet;

        public AzureStorageAdapterWsdlRetrieval(IWsdlRetrieval baseWsdlRetrieval)
        {
            this.mBaseWsdlRetrieval = baseWsdlRetrieval;
            this.schemaSet = new XmlSchemaSet();

        }

        System.Web.Services.Description.ServiceDescription IWsdlRetrieval.GetWsdl(MetadataRetrievalNode[] nodes, Uri uri, TimeSpan timeout)
        {
            System.Web.Services.Description.ServiceDescription description = this.mBaseWsdlRetrieval.GetWsdl(nodes, uri, timeout);
          
            return description;
          
         
            //TODO Add FileNameHint for generated Schema
            /*
            void CreateFileNameHint(XmlSchema schema, string fileNameHint)
            {
                //create the annotation and populate it with fileNameHint
                XmlSchemaAnnotation annotation = new XmlSchemaAnnotation();
                XmlSchemaAppInfo appInfo = new XmlSchemaAppInfo();
                XmlDocument doc = new XmlDocument();
                XmlNode[] fileNameHintNodes = new XmlNode[1];
                fileNameHintNodes[0] = doc.CreateElement(null, "fileNameHint", "http://schemas.microsoft.com/servicemodel/adapters/metadata/xsd");
                fileNameHintNodes[0].AppendChild(doc.CreateTextNode(fileNameHint));
                appInfo.Markup = fileNameHintNodes;
                annotation.Items.Add(appInfo);
                schema.Items.Insert(0, annotation);
            }

            */ 
        }

 

    }
}
